import requests



def get_symbols():
    url = "https://eapi.binance.com/eapi/v1/exchangeInfo"
    response = requests.get(url)
    data = response.json()
    optionSymbols = data['optionSymbols']
    return [(x['symbol'], x['underlying']) for x in optionSymbols]



symbols = get_symbols()
for symbol, underlying in symbols:
    expiration = symbol.split('-')[1]
    underlyingAsset = symbol.split('-')[0]
    url = f"https://eapi.binance.com//eapi/v1/openInterest?underlyingAsset={underlyingAsset}&expiration={expiration}"
    response = requests.get(url)
    datas = response.json()
    for data in datas:
        print(data)